#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
void test2()
{
    int val = 5;
    int ret = fork();
    if(ret > 0) //父进程
    {
        while(1)
        {
            printf("我是父进程,val=%d, &val=%p\n ",val,&val);
            sleep(5);
            val = 100;
            printf("我是父进程我修改了val的值,val=%d, &val=%p\n ",val,&val);
        }
    }
    else //子进程
    {
        while(1)
        {
            printf("我是子进程,pid=%d,val=%d, &val=%p\n",getpid(),val,&val);
            sleep(5);
        }
    }
}
void test1()
{
    int n = 0,m = 0;
    int ret1 = 0 , ret2 = 0;
    scanf("%d%d",&n,&m);
    int max = n,min = m;
    if(m > n)  
        max = m,min = n;
   
    int reminder = max % min;
    if(reminder == 0)
        ret1 = min;
    else
        ret1 = reminder;
    ret2 = abs(max*min)/reminder;
    printf("%d",ret1 + ret2);
}
int main()
{
    test2();
    //test1();

    // int a = 0,b=0;
    // scanf("%d-%d",&a,&b); //惊掉下巴了,这货居然还可以指定分隔符!!!

    // printf("%d %d",a,b);
    // //printf("早安,又是美好的一天\n");
    // return 0;
}